package com.dtranx.tools.corpora.ability.search;

import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery;
import com.dtranx.tools.corpora.ability.vo.MatchingVo;
import com.dtranx.tools.corpora.abilityapi.enums.SearchMode;

/**
 *
 * 模糊匹配
 *
 * @ClassName VagueSearchModeSearch
 * @Description TODO
 * @Date 2024/3/12 16:48
 * @Author ly
 **/
public class VagueSearchModeSearch extends AbstractModeSearch{

    @Override
    public void buildQueryBuilder0(BoolQuery.Builder queryBuilder, MatchingVo matchingVo) {
////        queryBuilder.filter(generateQueries0(matchingVo,matchingVo.getValue()));
////        queryBuilder.must(generateQueries0(matchingVo, matchingVo.getValue()));
//        List<Query> queries = generateQueries(matchingVo, matchingVo.getValue());
////        queryBuilder.filter(generateQueries0(matchingVo, matchingVo.getValue()));
//        queryBuilder.must(mustCase->{
//            mustCase.bool(builder -> {
//                builder.should(queries);
//                return builder;
//            });
//            return mustCase;
//        });
        queryBuilder.filter(generateQueries0(matchingVo,matchingVo.getValue()));
        queryBuilder.must(generateQueries(matchingVo, matchingVo.getValue()));
    }

    @Override
    public SearchMode getMode() {
        return SearchMode.VAGUE_SEARCH;
    }
}
